#!/usr/bin/perl
#creat_rsync.cgi

#require '../remotesync/remotesync-lib.pl';
require './shareman-lib.pl';
&ReadParse();
@minute=("*",0..59,);
@hour=("*",0..23);
@day=("*",1..31);
@month=("*",1..12);
@week=("*",0..6);
@bindwidth=("H","L");
#---------------text-----------
#$text{'timerule'} = "Time Rule";
#$text{'time_rule'} = "Time Policy";
#$text{'hour'} ="Hour";
#$text{'day'} = "Day";
#$text{'month'} = "Month";
#$text{'runnow'} = "Run Now";
#--------------------------------
&header($text{'timerule'}, "" , "index", 0, 1,);
#print $in{'sharedir'};
#print $in{'command'};
open(FG, "/sysvol/etc/cronfile");
@fr=<FG>;
close(FG);

$frr=$fr[0];
$frr =~ s/\r|\n//g;
@frrr = split(" ", $frr);
$hh = $frrr[1];
$dd = $frrr[2];
$mm = $frrr[3];
print "<form name='crform' action=modify.cgi methiod=post onsubmit='on_form_submit()'>\n";
print "<table class=mode1 width=80%>\n";

print "<tr><td width=150>$text{'time_rule'}</td><td>$text{'hour'}&nbsp;\n";
print "<select name=hour size=1>\n";
foreach(@hour){
	if($_ == $hh){
	 	print "<option value='$_' selected>$_</option>\n";
	}else{
		print "<option value='$_'>$_</option>\n"
	}
}
print "</select>";
print "</td></tr>\n";

print "<tr><td width=150></td><td>$text{'day'}&nbsp;&nbsp;\n";
print "<select name=day size=1>\n";
foreach(@day){
	if($_ == $dd){
   		print "<option value='$_' selected>$_</option>\n";
	}else{
		print "<option value='$_'>$_</option>\n";
	}
}
print "</select>";
print "</td></tr>\n";

print "<tr><td width=150></td><td>$text{'month'}\n";
print "<select name=month size=1>\n";
foreach(@month){
        if($_ == $mm){
                print "<option value='$_' selected>$_</option>\n";
        }else{
                print "<option value='$_'>$_</option>\n";
        }
}
print "</select>";
print "</td></tr>\n";





print "</table>\n";

print "<table border=0 class=mode1><tr><td>\n";
print "<input type=submit name=modify value=\"$text{'ok'}\" class=button1 onclick='return on_create_click(\"$text{'mirror_no_ipmodpath'}\");'>\n";
print "<input type=submit name=cancle value=\"$text{'runnow'}\" class=button1 onclick='return on_cancle_click()'>\n";
print "</td></tr></table>\n";
print "<input type=hidden name=cropt1>";
print "<input type=hidden name=cropt2>";

print "<input type=hidden name=crt_path value=\"$path\">";
print "<input type=hidden name=crt_mod value=\"$mod\">";
print "</form>\n";

print <<EOF;
<script>
function on_form_submit()
{

}
function on_create_click(mesg_no_ip)
{
}
function on_cancle_click()
{
    document.crform.action = "./run.cgi";
}
</script>
EOF

&footer("index.cgi", $text{'index'});
#&footer("/", "index.cgi");
#&redirect("index.cgi");
